package com.spring.jdkproxy;

import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;

@SuppressWarnings("ALL")
public class ViewBookHandler implements InvocationHandler , Serializable{

    private Object target;

    public ViewBookHandler(Object target){
        this.target = target;
    }

    @Override
    public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {

        System.out.println("去图书馆借书");
        method.invoke(target,args);
        System.out.println("还书");
        return null;
    }
}
